<?php

/**
 * This is the model class for table "users".
 *
 * The followings are the available columns in table 'users':
 * @property integer $id
 * @property string $username
 * @property string $name
 * @property string $password
 * @property integer $quota_max
 * @property integer $quota_current
 * @property string $email
 * @property string $mobile
 * @property integer $email_notification
 * @property integer $sms_notification
 * @property string $authentication_details_s1
 * @property integer $max_sessions
 * @property integer $language_id
 * @property string $authentication_details_s2
 * @property integer $authentication_source_id
 * @property integer $authentication_details_b1
 * @property integer $authentication_details_i2
 * @property string $authentication_details_d1
 * @property integer $authentication_details_i1
 * @property string $authentication_details_d2
 * @property integer $authentication_details_b2
 * @property string $last_login
 * @property integer $disabled
 */
class Usuarios extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Usuarios the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'users';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('disabled', 'required'),
			array('quota_max, quota_current, email_notification, sms_notification, max_sessions, language_id, authentication_source_id, authentication_details_b1, authentication_details_i2, authentication_details_i1, authentication_details_b2, disabled', 'numerical', 'integerOnly'=>true),
			array('username, name, password, email, mobile, authentication_details_s1, authentication_details_s2', 'length', 'max'=>255),
			array('authentication_details_d1, authentication_details_d2, last_login', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, username, name, password, quota_max, quota_current, email, mobile, email_notification, sms_notification, authentication_details_s1, max_sessions, language_id, authentication_details_s2, authentication_source_id, authentication_details_b1, authentication_details_i2, authentication_details_d1, authentication_details_i1, authentication_details_d2, authentication_details_b2, last_login, disabled', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'username' => 'Username',
			'name' => 'Name',
			'password' => 'Password',
			'quota_max' => 'Quota Max',
			'quota_current' => 'Quota Current',
			'email' => 'Email',
			'mobile' => 'Mobile',
			'email_notification' => 'Email Notification',
			'sms_notification' => 'Sms Notification',
			'authentication_details_s1' => 'Authentication Details S1',
			'max_sessions' => 'Max Sessions',
			'language_id' => 'Language',
			'authentication_details_s2' => 'Authentication Details S2',
			'authentication_source_id' => 'Authentication Source',
			'authentication_details_b1' => 'Authentication Details B1',
			'authentication_details_i2' => 'Authentication Details I2',
			'authentication_details_d1' => 'Authentication Details D1',
			'authentication_details_i1' => 'Authentication Details I1',
			'authentication_details_d2' => 'Authentication Details D2',
			'authentication_details_b2' => 'Authentication Details B2',
			'last_login' => 'Last Login',
			'disabled' => 'Disabled',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('password',$this->password,true);
		$criteria->compare('quota_max',$this->quota_max);
		$criteria->compare('quota_current',$this->quota_current);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('mobile',$this->mobile,true);
		$criteria->compare('email_notification',$this->email_notification);
		$criteria->compare('sms_notification',$this->sms_notification);
		$criteria->compare('authentication_details_s1',$this->authentication_details_s1,true);
		$criteria->compare('max_sessions',$this->max_sessions);
		$criteria->compare('language_id',$this->language_id);
		$criteria->compare('authentication_details_s2',$this->authentication_details_s2,true);
		$criteria->compare('authentication_source_id',$this->authentication_source_id);
		$criteria->compare('authentication_details_b1',$this->authentication_details_b1);
		$criteria->compare('authentication_details_i2',$this->authentication_details_i2);
		$criteria->compare('authentication_details_d1',$this->authentication_details_d1,true);
		$criteria->compare('authentication_details_i1',$this->authentication_details_i1);
		$criteria->compare('authentication_details_d2',$this->authentication_details_d2,true);
		$criteria->compare('authentication_details_b2',$this->authentication_details_b2);
		$criteria->compare('last_login',$this->last_login,true);
		$criteria->compare('disabled',$this->disabled);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}